package cn.lblbc.lib.download.db.bean

import androidx.room.ColumnInfo
import androidx.room.Entity
import androidx.room.PrimaryKey

@Entity(tableName = "download_part")
class DbDownloadPartInfo(
    @PrimaryKey(autoGenerate = true) var id: Long = 0,
    @ColumnInfo(name = "task_id") var taskId: String = "",
    @ColumnInfo(name = "part_start") var partStart: Long = 0,
    @ColumnInfo(name = "part_end") var partEnd: Long = 0,
    @ColumnInfo(name = "part_written") var partWritten: Long = 0
) {
    fun isDownloadComplete(): Boolean {
        return partWritten == partEnd - partStart + 1
    }
}